package com.hiyee.api.controller.user.fallback;

import com.hiyee.api.controller.user.ArticleControllerApi;
import com.hiyee.grace.result.ResponseJsonResult;
import com.hiyee.grace.result.ResponseStatusEnum;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class ArticleControllerFallbackFactory implements FallbackFactory<ArticleControllerApi> {
    @Override
    public ArticleControllerApi create(Throwable throwable) {
        return new ArticleControllerApi() {
            @Override
            public ResponseJsonResult hello() {
                System.out.println("进入客户端降级");
                return ResponseJsonResult.error(ResponseStatusEnum.SYSTEM_ERROR);
            }
        };
    }
}
